<template>
  <div class="ku-gou-theme" @mousedown.stop @dblclick.stop>
    <ul class="nav-list">
      <li>动态壁纸</li>
      <li class="checked">个性皮肤</li>
      <li>酷狗屏保</li>
      <li>桌面整理</li>
    </ul>
    <ol class="list">
      <li class="checked">推荐</li>
      <li>主题</li>
      <li>明星</li>
      <li>个性潮流</li>
      <li>其他</li>
      <li>纯色</li>
    </ol>
    <dl class="theme-content">
      <dt>推荐</dt>
      <dd>
        <div class="theme-item" :class="{ checked: theme === 'light' }" @click="$emit('changeTheme', 'light')">
          <div class="pic"><img src="@/assets/images/kuGou/light.png" alt="light" /></div>
          <span>默认皮肤</span>
          <em><i class="iconfont wos-checked-right" /></em>
        </div>
        <div class="theme-item" :class="{ checked: theme === 'dark' }" @click="$emit('changeTheme', 'dark')">
          <div class="pic"><img src="@/assets/images/kuGou/dark.png" alt="dark" /></div>
          <span>玄黛黑</span>
          <em><i class="iconfont wos-checked-right" /></em>
        </div>
        <div class="theme-item" :class="{ checked: theme === 'system' }" @click="$emit('changeTheme', 'system')">
          <div class="pic"><img src="@/assets/images/kuGou/system.png" alt="system" /></div>
          <span>跟随系统</span>
          <em><i class="iconfont wos-checked-right" /></em>
        </div>
      </dd>
      <dt>主题</dt>
      <dd>
        <div class="theme-item" :class="{ checked: theme === 'light' }" @click="$emit('changeTheme', 'light')">
          <div class="pic"><img src="@/assets/images/kuGou/thumb.jpg" alt="light" /></div>
          <span>默认皮肤</span>
          <em><i class="iconfont wos-checked-right" /></em>
        </div>
      </dd>
    </dl>
  </div>
</template>

<script setup lang="ts">
import type { PropType } from 'vue'

defineProps({
  theme: {
    type: String as PropType<string>,
    required: true
  }
})
</script>

<style scoped lang="scss">
.ku-gou-theme {
  width: 100%;
  height: 100%;

  .nav-list {
    height: 30px;
    display: flex;
    align-items: flex-end;
    padding-left: 40px;

    li {
      cursor: pointer;
      font-size: 18px;
      margin-right: 40px;
      color: var(--font-checked-color);

      &:hover {
        color: var(--hover-color);
      }

      &.checked {
        font-weight: 600;
        font-size: 24px;
        color: var(--font-checked-color);
      }
    }
  }

  .list {
    padding-bottom: 20px;
    padding-left: 40px;
    padding-top: 30px;
    display: flex;
    align-items: center;

    li {
      cursor: pointer;
      border-radius: 19px;
      height: 38px;
      line-height: 38px;
      padding: 0 20px;
      color: var(--font-checked-color);

      &:hover {
        color: var(--hover-color);
      }

      &.checked {
        color: var(--font-checked-color);
        background-color: var(--search-bg);
      }
    }
  }

  .theme-content {
    padding: 0 40px;
    height: calc(100% - 30px - 68px - 20px);
    overflow-y: auto;
    transition: color 0.3s;
    color: var(--font-checked-color);

    dt {
      font-size: 16px;
      padding-bottom: 20px;
    }

    dd {
      padding-bottom: 60px;
      display: flex;
      align-items: center;

      .theme-item {
        margin-right: 18px;
        display: flex;
        flex-direction: column;
        position: relative;

        &:hover {
          img,
          em {
            transform: translateY(-10px);
          }
        }

        &.checked {
          em {
            position: absolute;
            display: flex;
            justify-content: center;
            align-items: center;
            bottom: 36px;
            right: 10px;
            width: 26px;
            height: 26px;
            border-radius: 50%;
            background-color: rgb(53, 194, 255);
            color: #fff;
          }
        }

        .pic {
          width: 240px;
          height: 130px;
          margin-bottom: 10px;

          img {
            width: 100%;
            height: 100%;
            border-radius: 6px;
            object-fit: cover;
            object-position: left center;
            transition: all 0.3s;
          }
        }

        em {
          transition: all 0.3s;
          display: none;
        }
      }
    }
  }
}
</style>
